package com.itheima.app.controller;

import com.itheima.app.manager.MakeFriendManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.Map;

@RestController
public class BaiduController {

    @Autowired
    private MakeFriendManager makeFriendManager;
    //上报地理位置
    @PostMapping("/baidu/location")
    public ResponseEntity baiduLocation(@RequestBody Map<String,String> map) throws IOException {
        System.out.println("上报地理位置:" + map);
        String latitude = map.get("latitude"); //经度
        String longitude = map.get("longitude");//纬度
        String addrStr = map.get("addrStr");//地址
        return makeFriendManager.baiduLocation(latitude , longitude ,addrStr);
    }
}
